Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set local or session time_zone not work #4064

Merged
merged 2 commits into from
May 29, 2024

Conversation

killme2008
Copy link
Contributor

@killme2008 killme2008 commented May 28, 2024

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

See #3887

The doc PR GreptimeTeam/docs#988

What's changed and what's your intention?

Fix SET SESSION time_zone='Asia/Shanghai' or SET LOCAL time_zone='Asia/Shanghai' not work.

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR requires documentation updates.

@killme2008 killme2008 marked this pull request as ready for review May 28, 2024 22:19
@killme2008 killme2008 requested a review from a team as a code owner May 28, 2024 22:19
@github-actions github-actions bot added the docs-required This change requires docs update. label May 28, 2024
@github-actions github-actions bot added docs-not-required This change does not impact docs. and removed docs-required This change requires docs update. labels May 28, 2024
tisonkun

This comment was marked as resolved.

Copy link
Collaborator

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that "local" is the default manner for setting session variable.

While global variable starts with @@, we don't support any of them now:

Statement::SetVariables(set_var) => {
let var_name = set_var.variable.to_string().to_uppercase();
match var_name.as_str() {
// known vars
    _ => {
        return NotSupportedSnafu {
            feat: format!("Unsupported set variable {}", var_name),
        }
        .fail()
    }
}}

https://dev.mysql.com/doc/refman/8.0/en/set-variable.html

@killme2008
Copy link
Contributor Author

I noticed that "local" is the default manner for setting session variable.

While global variable starts with @@, we don't support any of them now:

Statement::SetVariables(set_var) => {
let var_name = set_var.variable.to_string().to_uppercase();
match var_name.as_str() {
// known vars
    _ => {
        return NotSupportedSnafu {
            feat: format!("Unsupported set variable {}", var_name),
        }
        .fail()
    }
}}

https://dev.mysql.com/doc/refman/8.0/en/set-variable.html

We don't have a plan to set global variables. This PR is trying to fix that set local {var} and set session {var} are not working, they are the same as set {var}.

@tisonkun tisonkun enabled auto-merge May 28, 2024 23:54
@tisonkun tisonkun added this pull request to the merge queue May 29, 2024
Copy link

codecov bot commented May 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.03%. Comparing base (4aa756c) to head (43e173d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4064      +/-   ##
==========================================
- Coverage   85.33%   85.03%   -0.31%     
==========================================
  Files         987      987              
  Lines      171204   171224      +20     
==========================================
- Hits       146094   145597     -497     
- Misses      25110    25627     +517     

Merged via the queue into GreptimeTeam:main with commit aafb468 May 29, 2024
28 checks passed
@killme2008 killme2008 deleted the fix/session-time-zone branch May 29, 2024 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required This change does not impact docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants